package com.ruoyi.rural.service.impl;

import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.rural.domain.RuralTurnover;
import com.ruoyi.rural.mapper.RuralTurnoverMapper;
import com.ruoyi.rural.service.IRuralTurnoverService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

/**
 * 出入登记Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-02-06
 */
@Service
public class RuralTurnoverServiceImpl implements IRuralTurnoverService 
{
    @Autowired
    private RuralTurnoverMapper ruralTurnoverMapper;

    /**
     * 查询出入登记
     * 
     * @param id 出入登记主键
     * @return 出入登记
     */
    @Override
    public RuralTurnover selectRuralTurnoverById(String id)
    {
        return ruralTurnoverMapper.selectRuralTurnoverById(id);
    }

    /**
     * 查询出入登记列表
     * 
     * @param ruralTurnover 出入登记
     * @return 出入登记
     */
    @Override
    public List<RuralTurnover> selectRuralTurnoverList(RuralTurnover ruralTurnover)
    {
        return ruralTurnoverMapper.selectRuralTurnoverList(ruralTurnover);
    }

    /**
     * 新增出入登记
     * 
     * @param ruralTurnover 出入登记
     * @return 结果
     */
    @Override
    public int insertRuralTurnover(RuralTurnover ruralTurnover)
    {
        ruralTurnover.setId(UUID.randomUUID().toString());
        ruralTurnover.setCreateTime(DateUtils.getNowDate());
        return ruralTurnoverMapper.insertRuralTurnover(ruralTurnover);
    }

    /**
     * 修改出入登记
     * 
     * @param ruralTurnover 出入登记
     * @return 结果
     */
    @Override
    public int updateRuralTurnover(RuralTurnover ruralTurnover)
    {
        ruralTurnover.setUpdateTime(DateUtils.getNowDate());
        return ruralTurnoverMapper.updateRuralTurnover(ruralTurnover);
    }

    /**
     * 批量删除出入登记
     * 
     * @param ids 需要删除的出入登记主键
     * @return 结果
     */
    @Override
    public int deleteRuralTurnoverByIds(String[] ids)
    {
        return ruralTurnoverMapper.deleteRuralTurnoverByIds(ids);
    }

    /**
     * 删除出入登记信息
     * 
     * @param id 出入登记主键
     * @return 结果
     */
    @Override
    public int deleteRuralTurnoverById(String id)
    {
        return ruralTurnoverMapper.deleteRuralTurnoverById(id);
    }
}
